﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SQLite;
using System.Data.Common;

namespace ZhCun.Framework.DataAccess.DbHelper
{
    public class SQLiteHelper : DbHelperBase
    {
        public SQLiteHelper(string connStr)
            : base(connStr)
        { }
        SQLiteConnection _DBConnectionObj;
        SQLiteCommand _DbCommandObj;
        SQLiteDataAdapter _DbDataAdapterObj;

        protected override DbConnection DBConnectionObj
        {
            get
            {
                //SqlBulkCopy aa = new SqlBulkCopy(new SqlConnection());
                if (_DBConnectionObj == null)
                {
                    _DBConnectionObj = new SQLiteConnection(_ConnStr);
                }
                return _DBConnectionObj;
            }
        }

        protected override DbCommand DbCommandObj
        {
            get
            {
                if (_DbCommandObj == null)
                {
                    _DbCommandObj = new SQLiteCommand();
                }
                return _DbCommandObj;
            }
        }

        protected override DbDataAdapter DbDataAdapterObj
        {
            get
            {
                if (_DbDataAdapterObj == null)
                {
                    _DbDataAdapterObj = new SQLiteDataAdapter();
                }
                return _DbDataAdapterObj;
            }
        }
    }
}
